home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / MacHacksBug / Python 1.5.2c1 / Extensions / Imaging / PIL / ImageFileIO.py < prev    next >
Encoding:
Python Source  |  2000-06-23  |  637 b   |  29 lines

  1. #
  2. # The Python Imaging Library.
  3. # $Id: ImageFileIO.py,v 1.1.1.1 1999/01/13 09:40:07 sjoerd Exp $
  4. #
  5. # kludge to get basic ImageFileIO functionality
  6. #
  7. # History:
  8. # 98-08-06 fl    Recreated
  9. #
  10. # Copyright (c) Secret Labs AB 1998.
  11. #
  12. # See the README file for information on usage and redistribution.
  13. #
  14.  
  15. from StringIO import StringIO
  16.  
  17. class ImageFileIO(StringIO):
  18.     def __init__(self, fp):
  19.     data = fp.read()
  20.     StringIO.__init__(self, data)
  21.  
  22. if __name__ == "__main__":
  23.  
  24.     import Image
  25.     fp = open("/images/clenna.im", "rb")
  26.     im = Image.open(ImageFileIO(fp))
  27.     im.load() # make sure we can read the raster data
  28.     print im.mode, im.size
  29.